//package com.jichaoyun.sys.controller;
//
//
//import com.jichaoyun.model.entity.StationInfo;
//
//import com.jichaoyun.common.model.PagedResult;
//import com.jichaoyun.common.model.Result;
//import com.jichaoyun.sys.service.IRealdataCacheService;
//import com.jichaoyun.sys.service.IRealdataService;
//import com.jichaoyun.sys.service.IStationInfoService;
//import io.swagger.annotations.Api;
//import io.swagger.annotations.ApiOperation;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.web.bind.annotation.GetMapping;
//import org.springframework.web.bind.annotation.RequestMapping;
//import org.springframework.web.bind.annotation.RestController;
//
//import java.time.LocalDateTime;
//import java.time.format.DateTimeFormatter;
//import java.util.ArrayList;
//import java.util.HashMap;
//import java.util.List;
//import java.util.Map;
//
///**
// * @author zhen
// */
//@RestController
//@Api(tags = {"管损接口"})
//@RequestMapping("/sys/PipeLossInfo")
//public class PipeLossController {
//    @Autowired
//    private IStationInfoService stationInfoService;
//
//    @Autowired
//    private IRealdataService realdataService;
//
//    @Autowired
//    private IRealdataCacheService realdataCacheService;
//
//
//
//    @ApiOperation("管损报表查询-查询所有的非用户站点")
//    @GetMapping("/getAllLineStationName")
//    public Result<List<Map<String,Object>>> getAllLineStationName(){
//        List<Map<String,Object>> res = new ArrayList<>();
//        List<StationInfo> allLineStationName = stationInfoService.getAllLineStation();
//        for (StationInfo stationInfo : allLineStationName) {
//            HashMap<String, Object> map = new HashMap<>();
//            map.put("StationName",stationInfo.getStationName());
//            map.put("StationNo",stationInfo.getStationNo());
//            res.add(map);
//        }
//        return  Result.success(res);
//    }
//
//    @ApiOperation(value = "管损报表查询-查询左边的list,以及右边的list",notes = "日期和时间是是yyyy-MM-dd HH:mm")
//    @GetMapping("/getLineLossForm")
//    public Result<PagedResult> getLineLossForm(String startTime,String endTime, Integer pageNo, Integer StationNo){
//
//        DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm");
//
//        LocalDateTime start = LocalDateTime.parse(startTime,dateTimeFormatter);
//        LocalDateTime end = LocalDateTime.parse(endTime,dateTimeFormatter);
//
//        PagedResult pagedResult = realdataService.getLineLossForm(pageNo,start,end,StationNo);
//
//        return Result.success(pagedResult);
//    }
//
//    @ApiOperation(value = "管损报表查询-查询右边的图，默认查找最近十分钟的数据")
//    @GetMapping("/getTenMinutesLineLossForm")
//    public Result<Map<String,Object>> getTenMinutesLineLossForm(Integer StationNo){
//
//        Map<String,Object> res = realdataCacheService.getTenMinutesLineLossForm(StationNo);
//
//        return Result.success(res);
//    }
//
//    @ApiOperation(value = "管损报表查询-查询右边的图，选择区间内的数据",notes = "日期和时间是是yyyy-MM-dd HH:mm，精确到分钟")
//    @GetMapping("/getPeriodLineLossForm")
//    public Result<Map<String,Object>> getPeriodLineLossForm(Integer StationNo,String startTime,String endTime){
//
//        DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm");
//
//        LocalDateTime start = LocalDateTime.parse(startTime,dateTimeFormatter);
//        LocalDateTime end = LocalDateTime.parse(endTime,dateTimeFormatter);
//
//        Map<String,Object> res = realdataService.getPeriodLineLossForm(StationNo,start,end);
//
//        return Result.success(res);
//    }
//
//
//}
